#include<iostream>

using namespace std;


const int N=31622;
int primes[N+1];

auto Init=[]
{
    for(int i=2;i<=N;++i)
    {
        if(primes[i]==0)
        {
            primes[i]=primes[i-1]+1;
            for(int j=i*i;j<=N;j+=i) primes[j]=-1;
        }
        else
        {
            primes[i]=primes[i-1];
        }
    }
    return 0;
}();

class Solution {
public:
    int nonSpecialCount(int l, int r) {
        return r-l+1-(primes[(int)sqrt(r)]-primes[(int)sqrt(l-1)]);
    }
};